<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<div class="page_right settingspage_right">

    <%@ include file="/resources/modular/plugin/FcatoryGetMobileCode.jsp" %>

    <div class="settings_setTelNext" id="GC_securitity_next" style="display:none;">
        <span>手机号码：</span>
        <input class="settings_settel_newtel" type="text" placeholder="请输入需要绑定的手机号码">
        <input type="button" class="settings_confirmbtn" value="确认">
    </div>
</div>
<script type="application/javascript">

    //更换手机号码
    $(".settings_settel_newtel").on("keyup keydown focus", function(){
        var settings_newtel="";
        settings_newtel=$(this).val();
        if(settings_newtel!=""){
            $(".settings_confirmbtn").addClass("cur").removeAttr("disabled","disabled");
        }else{
            $(".settings_confirmbtn").removeClass("cur").attr("disabled","disabled");
        }
    });

    $(".settings_confirmbtn").click(function () {
        var mobilenumber = $(".settings_settel_newtel").val();
        var mobilecode = $(".settings_codeinput").val();
        if (typeof(mobilenumber) == "undefined" || mobilenumber.length <= 0) {
            alert("手机号不能为空");
        } else if (typeof(mobilecode) == "undefined" || mobilecode.length <= 0) {
            alert("短信验证码不能为空");
        } else {
            $.ajax({
                url: '${basePath}v2/factory/systemsetup/changmobile',
                type: 'POST',
                data: {
                    "mobileCode": mobilecode,
                    "mobileNumber": mobilenumber
                },
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if (ret.result) {
                        alert("更改手机号码成功", "cur");
                    } else {
                        alert(ret.info);
                    }
                }
            });
        }
    })

</script>